#include "MinMax2DBox.h"
using namespace geom;
MinMax2DBox::MinMax2DBox(const Point2D &p1): m_min(p1), m_max(p1)
{
}

MinMax2DBox::MinMax2DBox(const Point2D &p1, const Point2D &p2, const Point2D &p3) : m_min(p1), m_max(p1)
{
	updateBoxWith(p2);
	updateBoxWith(p3);
}

MinMax2DBox::MinMax2DBox(const Point3D &p1) : m_min(point3DTo2D(p1)), m_max(point3DTo2D(p1))
{
}

MinMax2DBox::MinMax2DBox(const Point3D &p1, const Point3D &p2, const Point3D &p3) : m_min(point3DTo2D(p1)), m_max(point3DTo2D(p1))
{
	updateBoxWith(point3DTo2D(p2));
	updateBoxWith(point3DTo2D(p3));
}

bool MinMax2DBox::containsPoint(const Point2D &p) const
{ 
	return containsPoint(p.x,p.y);
}

bool MinMax2DBox::containsPoint(float x, float y) const
{
	if(x < m_min.x || x > m_max.x || y < m_min.y || y > m_max.y)
		return false;
    return true;
}
